package com.tiancai.pojo.po;

import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;
import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.tiancai.enums.PayStatus;
import com.tiancai.enums.PayType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 * 
 * </p>
 *
 * @author tiancai
 * @since 2025-03-17
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("orders")
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Schema(name = "订单表")
public class Orders implements Serializable {

    private static final long serialVersionUID = 1L;
    //0-已完成 1-已退款
    public static final Integer TYPE_BUY = 0;
    public static final Integer TYPE_REFUND = 1;

    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description = "id")
    private Long id;

    /**
     * 订单编号
     */
    @Schema(description = "订单编号")
    private String code;

    /**
     * 0-购买 1-租赁
     */
    @Schema(description = "订单类型,0-购买 1-租赁")
    private PayType type;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill= FieldFill.INSERT)
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    @Schema(description = "修改时间")
    private LocalDateTime updateTime;

    /**
     * 货币类型 USD：美元 CNY：人民币
     */
    @Schema(description = "货币类型 USD：美元 CNY：人民币")
    private String currency;

    /**
     * 顾客Id
     */
    @Schema(description = "顾客Id")
    private Long customerId;

    /**
     * 卖家Id
     */
    @Schema(description = "卖家Id")
    private Long sellerId;

    /**
     * 作品Id
     */
    @Schema(description = "作品Id")
    private Long productId;
    /**
     * 成交价格
     */
    @Schema(description = "成交价格")
    private Double price;

    /**
     * 支付方式
     */
    @Schema(description = "支付方式")
    private String payMethod;

    /**
     * 0-已完成 1-已退款
     */
    @Schema(description = "0-已完成 1-已退款")
    private PayStatus payStatus;

}
